<template>
	<!-- 头部 -->
	<view class="all">
		<!-- 登录 -->
		<view class="top" @tap="login()">
			<image src="../../static/image/my/login_log.png"></image>
			<view class="head">
				<view class="head-log">
					<text style="font-size: 35rpx;font-weight: bold;">立即登录</text>
					<view class="">
						<text style="font-size: 20rpx;color: #ccc;">登录后可收藏喜欢的菜谱</text>
					</view>
				</view>
				<text>〉</text>
			</view>
		</view>
		<!-- vip -->
		<view class="top_img">
			<view class="ti_logo">
				<text style="margin-left: 60rpx;">升级成VIP</text>
				<text>〉</text>
			</view>
		</view>
		<!-- 主体内容 -->
		<view class="main">
			<!-- 收藏内容 -->
			<view class="collection">
				<view class="my_col" v-for="item in collect" :key="item.id">
					<image :src="item.img" mode=""></image>
					<view>
						<text>{{item.text}}</text>
					</view>
				</view>
			</view>
			<!-- 推荐 -->
			<view class="text">
				<view class="text-tit">
					<text v-for="item in title" :class="item.done ? 'active': ''" @click="change(item.id)"
						:key="item.id">{{item.text}}</text>
				</view>
				<swiper :indicator-dots="false" :autoplay="false" class="swiper-container" :current="currut">
					<swiper-item>
						<view class="swiper-item1">
							<view class="si_all" v-for="item in foodmes" :key="item.id">
								<text>{{item.text}}</text>
								<text style="margin-left: 350rpx;">{{item.num}}</text>
							</view>
							<view class="sw_all">
								<text>展开全部</text>
								<image src="../../static/image/my/xiala.png"></image>
							</view>
						</view>
					</swiper-item>
					<swiper-item>
						<view class="swiper-item1">
							<view class="si_all" v-for="item in foodmes" :key="item.id">
								<text>{{item.text}}</text>
								<text style="margin-left: 350rpx;">{{item.num}}</text>
							</view>
							<view class="sw_all">
								<text>展开全部</text>
								<image src="../../static/image/my/xiala.png"></image>
							</view>
						</view>
					</swiper-item>
				</swiper>
			</view>
			<!-- 我的菜谱 -->
			<view class="myfood">
				<view class="myfood_top">
					<text>我的菜谱</text>
				</view>
				<scroll-view scroll-x="true" class="socll" enable-flex='true'>
					<view class="sv_text" v-for="item in myfood" :key='item.id'>
						<image @tap="godetails(item.id,item.name)" :src="item.img" class="svt_img"></image>
						<view class="svt_text">
							<text>{{item.name}}</text>
						</view>
					</view>
				</scroll-view>

			</view>

			<!-- 评分 -->
			<view class="score" style="margin-top: 20rpx;">
				<image src="../../static/image/my/right.png"></image>
				<view class="sc_te" style="border-bottom: 2rpx solid #ccc;">
					<text>去App Store给菜谱大全评分</text>
					<text>〉</text>
				</view>

			</view>
			<!-- 反馈问题 -->
			<view class="score" style="margin-bottom: 30rpx;">
				<image src="../../static/image/my/msg.png"></image>
				<view class="sc_te">
					<text>反馈问题</text>
					<text>〉</text>
				</view>

			</view>
		</view>


	</view>

</template>

<script>
	export default {
		data() {
			return {
				collect: [{
						id: 1,
						text: '我的收藏',
						img: '../../static/image/my/star.png'
					},
					{
						id: 2,
						text: '浏览记录',
						img: '../../static/image/my/rec.png'
					},
					{
						id: 3,
						text: '点赞',
						img: '../../static/image/my/good.png'
					}
				],
				title: [{
						id: 0,
						text: '所有食材',
						done: true
					},
					{
						id: 1,
						text: '密度是是',
						done: false
					},
					{
						id: 2,
						text: '所有食材',
						done: false
					},
					{
						id: 3,
						text: '所有食材',
						done: false
					},
					{
						id: 4,
						text: '所有食材',
						done: false
					},
				],
				currut: 0,
				foodmes: [{
						id: 1,
						text: "就看见",
						num: '500g'
					},
					{
						id: 2,
						text: "就看见",
						num: '500g'
					},
					{
						id: 3,
						text: "就看见",
						num: '500g'
					},
					{
						id: 4,
						text: "就看见",
						num: '500g'
					},
					{
						id: 5,
						text: "就看见",
						num: '500g'
					}
				],
				myfood: [{
						id: 1,
						name: '好吃的',
						img: '../../static/image/my/food1.png'
					},
					{
						id: 2,
						name: '好吃的',
						img: '../../static/image/my/food2.png'
					},
					{
						id: 3,
						name: '好吃的',
						img: '../../static/image/my/food3.png'
					},
					{
						id: 4,
						name: '好吃的',
						img: '../../static/image/my/food4.png'
					},
					{
						id: 5,
						name: '好吃的',
						img: '../../static/image/my/food1.png'
					}
				]

			}
		},
		methods: {
			change(val) {
				this.currut = val
				this.title.map(item => {
					if (item.id == val) {
						item.done = true
					} else {
						item.done = false
					}
					return item
				})
			},
			login(){
				uni.navigateTo({
					url:"../login/login"
				})
			},
			godetails(text,text2){
				uni.navigateTo({
					url:'../foodsDetails/foodsDetails?name='+text2,
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top {
		display: flex;
		align-items: center;
		margin-top: 40rpx;
		width: 750rpx;

		image {
			width: 150rpx;
			height: 150rpx;
			margin-left: 32rpx;
		}

		.head {
			display: flex;
			align-items: center;
			width: 500rpx;
			margin-left: 24rpx;
			justify-content: space-between;
		}
	}

	.top_img {
		width: 100%;
		padding: 40rpx 40rpx;
		box-sizing: border-box;

		.ti_logo {
			width: 650rpx;
			height: 120rpx;
			background-image: url(../../static/image/my/logo2.png);
			background-repeat: no-repeat;
			background-size: cover;
			box-sizing: border-box;
			padding: 20rpx 40rpx;
			display: flex;
			justify-content: space-between;
			color: #b4853f;
			font-size: 30rpx;
		}

	}

	// 主体内容

	.main {
		background-color: #f5f5f5;
		width: 750rpx;
		margin-bottom: 20rpx;
		overflow: hidden;

		.collection {
			box-sizing: border-box;
			height: 120rpx;
			border-radius: 15rpx;
			padding: 10rpx 10rpx;
			display: flex;
			margin-top: 20rpx;
			justify-content: space-evenly;
			background-color: #ffffff;

			.my_col {
				text-align: center;
				width: 200rpx;
				vertical-align: middle;

				image {
					width: 40rpx;
					height: 40rpx;
				}
			}
		}

		//推荐
		.text {
			margin-top: 20rpx;
			box-sizing: border-box;
			padding: 10rpx 20rpx;
			background-color: #ffffff;

			.swiper-container {
				pointer-events: none;
				height: 500rpx;
			}

			.text-tit {
				margin-top: 20rpx;
				display: flex;
				justify-content: space-between;
				border-bottom: 4rpx solid #f1f1f1;
				padding-bottom: 10rpx;
				font-size: 30rpx;

				.active {
					color: #ee7b2d;
					font-size: 30rpx;
					font-weight: bold;
				}
			}

			.swiper-item1 {
				.si_all {
					border-bottom: 4rpx solid #f1f1f1;
					margin-top: 30rpx;
					padding-bottom: 10rpx;
					box-sizing: border-box;
				}

				.sw_all {
					margin-top: 25rpx;
					text-align: center;
					font-size: 25rpx;

					image {
						width: 25rpx;
						height: 25rpx;
						margin-left: 10rpx;
						vertical-align: middle;
					}

				}
			}

		}

		//我的菜谱
		.myfood {
			background-color: #FFFFFF;
			height: 360rpx;
			margin-top: 20rpx;

			.myfood_top {
				padding: 20rpx 15rpx;
			}

			.socll {
				display: flex;
				height: 245prx;

				.sv_text {
					width: 180rpx;
					padding: 0 15rpx;

					.svt_img {
						width: 180rpx;
						height: 210rpx;
					}

					.svt_text {
						text-align: center;
					}
				}
			}
		}

		//评分
		.score {
			display: flex;
			background-color: #ffffff;
			padding: 10rpx 20rpx;
			color: #5a5a5a;

			image {
				width: 40rpx;
				height: 40rpx;
				padding: 20rpx 0;
				vertical-align: middle;
			}

			.sc_te {
				display: flex;
				width: 650rpx;
				box-sizing: border-box;
				justify-content: space-between;
				padding: 20rpx 20rpx;
				vertical-align: middle;
			}
		}
	}
</style>
